package inabit.impl.data;

import inabit.impl.data.types.ContinuousType;
/**Numeric variable that represents a double within a interval
 * @author Rafael Rocha*/
public class ContinuousVariable extends NumericVariable{

	public ContinuousVariable(String id) {
		this(id, Double.MIN_VALUE, Double.MAX_VALUE);
		
	}
	public ContinuousVariable(String id, double min, double max) {
		super(id, new ContinuousType(min, max));
		getInfo().setGreaterOrEqual(Double.toString(min));
		getInfo().setLessOrEqual(Double.toString(max));
		tryAssignValue();
		save();
	}
	@Override
	public void tryAssignValue() {
		if(getInfo().getMin() == getInfo().getMax()) {
			setValue(getInfo().getMin().toString());
		}
	}

}
